package com.irdstudio.apicenter.console.service.authenticate;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.irdstudio.apicenter.console.dm.AppMenuResource;
import com.irdstudio.apicenter.console.dm.AppMenuResourceDao;

@Service(value = "appMenuResourceService")
public class AppMenuResourceService {

	@Autowired
	private AppMenuResourceDao appMenuResourceDao;

	public int insertOne(AppMenuResource appMenuResource) throws SQLException,
			ClassNotFoundException {
		return appMenuResourceDao.saveAppMenuResource(appMenuResource);
	}

	public AppMenuResource queryAppMenuDetail(String appId, String menuId)
			throws SQLException {
		return appMenuResourceDao.queryWithKeys(appId, menuId);
	}

	public int update(AppMenuResource appMenuResource) throws SQLException,
			ClassNotFoundException {
		return appMenuResourceDao.update(appMenuResource);
	}

	public int delete(String appId, String menuId) throws SQLException {
		// TODO Auto-generated method stub
		return appMenuResourceDao.delete(appId, menuId);
	}

	public List<AppMenuResource> queryMenusByRoleId(String appRoleId,
			String appId) throws SQLException {
		// TODO Auto-generated method stub
		return appMenuResourceDao.queryMenusByRoleId(appRoleId, appId);
	}

	public int insertRoleRight(String menuStr, String appId, String appRoleId)
			throws SQLException {
		// TODO Auto-generated method stub
		return appMenuResourceDao.insertRoleRight(menuStr, appId, appRoleId);
	}

}
